/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import interfaces.InternationalizableEntity;
import interfaces.InternationalizableEntityDescription;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author damfercer
 */
@Entity
@Table(name = "language_level_description")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "LanguageLevelDescription.findAll", query = "SELECT l FROM LanguageLevelDescription l"),
    @NamedQuery(name = "LanguageLevelDescription.findByIdLanguageLevelDescription", query = "SELECT l FROM LanguageLevelDescription l WHERE l.idLanguageLevelDescription = :idLanguageLevelDescription"),
    @NamedQuery(name = "LanguageLevelDescription.findByDescription", query = "SELECT l FROM LanguageLevelDescription l WHERE l.description = :description")})
public class LanguageLevelDescription implements Serializable,InternationalizableEntityDescription {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_LANGUAGE_LEVEL_DESCRIPTION")
    private Integer idLanguageLevelDescription;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "DESCRIPTION")
    private String description;
    @JoinColumn(name = "LANGUAGE_LEVEL", referencedColumnName = "ID_LANGUAGE_LEVEL")
    @ManyToOne(optional = false)
    private LanguageLevel languageLevel;
    @JoinColumn(name = "LANGUAGE", referencedColumnName = "ID_LANGUAGE")
    @ManyToOne(optional = false)
    private Language language;

    public LanguageLevelDescription() {
    }

    public LanguageLevelDescription(Integer idLanguageLevelDescription) {
        this.idLanguageLevelDescription = idLanguageLevelDescription;
    }

    public LanguageLevelDescription(Integer idLanguageLevelDescription, String description) {
        this.idLanguageLevelDescription = idLanguageLevelDescription;
        this.description = description;
    }

    public Integer getIdLanguageLevelDescription() {
        return idLanguageLevelDescription;
    }

    public void setIdLanguageLevelDescription(Integer idLanguageLevelDescription) {
        this.idLanguageLevelDescription = idLanguageLevelDescription;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public LanguageLevel getLanguageLevel() {
        return languageLevel;
    }

    public void setLanguageLevel(LanguageLevel languageLevel) {
        this.languageLevel = languageLevel;
    }

    public Language getLanguage() {
        return language;
    }

    public void setLanguage(Language language) {
        this.language = language;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idLanguageLevelDescription != null ? idLanguageLevelDescription.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof LanguageLevelDescription)) {
            return false;
        }
        LanguageLevelDescription other = (LanguageLevelDescription) object;
        if ((this.idLanguageLevelDescription == null && other.idLanguageLevelDescription != null) || (this.idLanguageLevelDescription != null && !this.idLanguageLevelDescription.equals(other.idLanguageLevelDescription))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.LanguageLevelDescription[ idLanguageLevelDescription=" + idLanguageLevelDescription + " ]";
    }

    @Override
    public InternationalizableEntity getEntity() {
        return getLanguageLevel();
    }
    
}
